package ro.prjmanager.core.dao;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;


public class Filter {
    private String propertyName;
    private Object propertyValue;
    private String alias;
    private String opp;

    public Filter(String propertyName, Object propertyValue, String alias, String opp) {
        this.propertyName = propertyName;
        this.propertyValue = propertyValue;
        this.alias = alias;
        this.opp = opp;
    }

    public Filter(String propertyName, Object propertyValue, String opp) {
        this.propertyValue = propertyValue;
        this.propertyName=propertyName.substring(propertyName.indexOf(".")+1);
        this.opp=opp;
        this.alias=propertyName.substring(0,propertyName.indexOf("."));


        this.propertyValue = propertyValue;
        this.opp = opp;
    }

    public boolean isString(){
        return propertyValue!=null&&propertyValue instanceof String;
    }

    public boolean isLong(){
        return propertyValue!=null&&propertyValue instanceof Long;
    }

    public boolean isInteger(){
        return propertyValue!=null&&propertyValue instanceof Integer;
    }

    public boolean isDate(){
        return propertyValue!=null&&propertyValue instanceof Date;
    }


    public boolean isBigDecimal(){
        return propertyValue!=null&&propertyValue instanceof BigDecimal;
    }

    public boolean isList(){
         return propertyValue!=null&&propertyValue instanceof ArrayList;
    }

    public String getPropertyName() {
        return propertyName;
    }

    public void setPropertyName(String propertyName) {
        this.propertyName = propertyName;
    }

    public Object getPropertyValue() {
        return propertyValue;
    }

    public void setPropertyValue(Object propertyValue) {
        this.propertyValue = propertyValue;
    }

    public String getAlias() {
        return alias;
    }

    public void setAlias(String alias) {
        this.alias = alias;
    }

    public String getOpp() {
        return opp;
    }

    public void setOpp(String opp) {
        this.opp = opp;
    }
}
